import { reqCreateProjectApply, reqGetTeacherListByApplyProject } from "@/api";
import { Message } from "element-ui";
export default({
    namespaced:true,
    actions:{
        async getTeacherList(context){
            let result=await reqGetTeacherListByApplyProject();
            if(result.code==='200'){
                context.commit('getTeacherList',result.other)
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        },
        async createProjectApply(context,value){
            let result=await reqCreateProjectApply(value);
            if(result.code==='200'){
                context.commit('createProjectApply')
            }else{
                Message({
                    message: '警告!'+'['+result.code+']'+'['+result.message+']',
                    type: 'warning'
                })
                return;
            }
        }
    },
    mutations:{
        getTeacherList(state,value){
            state.teacherList=value
        },
        createProjectApply(){
            alert("申请提交成功");
            history.go(0);
        }
    },
    state:{
        teacherList:[]
    },
    getters:{

    }
})